package com.java.util;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;

import com.xa.common.utils.json.JsonUtils;

public class MapNullTest {

    public static void main(String[] args) {
        try {
            HashMap<Integer, Integer> hashMap = new HashMap<>();
            hashMap.put(null, null);
            hashMap.put(null, null);
            
            System.out.println(JsonUtils.object2String(hashMap));
        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            Hashtable<Integer, Integer> hashtable = new Hashtable<>();
            hashtable.put(null, 1);
            hashtable.put(null, 2);
            
            System.out.println(JsonUtils.object2String(hashtable));
        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            TreeMap<Integer, Integer> treeMap = new TreeMap<>();
            treeMap.put(1, null);
            treeMap.put(2, null);
            
            System.out.println(JsonUtils.object2String(treeMap));
        } catch (Exception e) {
            e.printStackTrace();
        }
        
        try {
            ConcurrentHashMap<Integer, Integer> concurrentHashMap = new ConcurrentHashMap<>();
            concurrentHashMap.put(null, null);
            concurrentHashMap.put(null, null);
            
            System.out.println(JsonUtils.object2String(concurrentHashMap));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
